<template>
  <div>
    <div class="groggery">
        <!-- 搜索 -->
      <el-card class="box-card">
        <div class="clearfix">
          <div class="container">
            <el-form size="small" label-width="100px">
              <el-form-item label="记录人标题" class="width100">
                <el-input
                  v-model="recorder"
                  placeholder="请输入记录人标题"
                  class="selWidth"
                  size="small"
                  clearable
                >
                  <el-button
                    slot="append"
                    icon="el-icon-search"
                    size="small"
                    @click="seachList"
                  />
                </el-input>
              </el-form-item>
            </el-form>
            <!-- <div style="margin-left:16px">
              <el-button
                class="mr10"
                size="small"
                type="primary"
                @click="addgInfo()"
                >添加记录</el-button
              >
            </div> -->
          </div>
        </div>
      </el-card>
      <div class="mt20"></div>
      <!-- bod -->
      <el-table :data="tableData">
        <el-table-column prop="title" label="记录标题" align="center">
        </el-table-column>
        <el-table-column
          fixed
          prop="authorName"
          label="记录人名称"
          align="center"
          width="200"
        >
        </el-table-column>
        <el-table-column prop="content" label="记录人内容" align="center">
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间" align="center">
        </el-table-column>
        <el-table-column prop="updateTime" label="更新时间" align="center">
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="300" align="center">
          <template slot-scope="scope">
            <router-link :to="{ path: '/amszs/businessRecord/businessRecordDetail/' + scope.row.id }">
              <el-button
              type="text"
              size="small"
              class="mr10"
              @click="details(scope.row.id)"
              >详情</el-button
            >
            </router-link>
            <!-- <router-link :to="{ path: '/amszs/businessRecord/businessRecordEadd/' + scope.row.id }">
            <el-button
              type="text"
              size="small"
              class="mr10"
              @click="edit(scope.row.id)"
              >编辑</el-button
            >
            </router-link>   -->
            <!-- <el-button
              type="text"
              size="small"
              class="mr10"
              @click="del(scope.row.id)"
              >删除</el-button
            > -->
          </template>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="loadData"
          :current-page.sync="pagesize.page"
          :page-sizes="[20, 40, 60, 80]"
          :page-size="pagesize.limit"
          layout="total,sizes,prev, pager, next,jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import { businessListApi } from "@/api/businessRecord";
export default {
  name: "businessRecord",
  components: {},
  data() {
    return {
      //列表数据
      tableData: [],
      // 酒店详情
      grogdList: [],
      pagesize: {
        // 每页数量
        limit: 20,
        // 页码
        page: 1
      },
      // 总数据量
      total: 0,
      // 总页数
      totalPage: 0,
      // 详情
      dialogVisible: false,
      //searchimput
      recorder: ""
    };
  },
  created() {
    this.loadData();
  },
  methods: {
    // 详情
    async details(id) {
      // console.log("详情", id);
    },
    // 删除
    // async del(id) {
    //   console.log("删除", id);
    //     try {
    //       await this.$confirm("是否删除该酒店", {
    //         confirmButtonText: "确定",
    //         cancelButtonText: "取消",
    //         type: "warning"
    //       });
    //       await delbusinessApi({ id: id });
    //       this.$message.success("删除成功");
    //       this.loadData();
    //     } catch {}
    // },
    // 获取业务列表
    async loadData() {
      const res = await businessListApi(this.pagesize);
      this.total = res.total;
      this.totalPage = res.totalPage;
      this.tableData = res.list;
    },
    // 搜索
    async seachList() {
      this.pagesize.page = 1;
      const resggg = await businessListApi({ title: this.recorder });
      console.log('resggg:', resggg)
      this.tableData = resggg.list;
      this.total = this.tableData.length;
    },
    pageChange(page) {
      this.pagesize.page = page;
      this.getList();
    },
    handleSizeChange(val) {
      this.pagesize.limit = val;
      this.loadData();
    }
    // 添加业务记录
    // addgInfo() {
    //   this.$router.push('/amszs/businessRecord/businessRecordEadd')
    // }
  }
};
</script>

<style lang="scss" scoped>
.groggery {
  padding: 20px;
  .block {
    padding: 20px;
    text-align: right;
    width: 100%;
    background-color: #ffffff;
  }
}
.Publicityimg {
  img {
    width: 50px;
    height: 50px;
  }
}
</style>
